﻿@model Aspnetcore.OrderingApp.Models.Order
@inject Aspnetcore.OrderingApp.Services.IFormDataService FormDataHelper

<div id="page-wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">
                Place a New Order<br/>
                <small>It's what keeps us in business!</small>
            </h1>
        </div>
    </div>
    <form id="full-page-form" asp-action="NewOrder" asp-controller="Order" method="post">
        <div class="row">
            <div class="col-md-6">
                <div asp-validation-summary="All"></div>
                <div class="row form-group">
                    <label asp-for="ClientId" class="col-xs-12">Client Id</label>
                    <div class="col-xs-9">
                        <input asp-for="ClientId" class="form-control"/>
                    </div>
                    <div class="col-xs-3">
                        <button class="btn btn-default">Lookup</button>
                    </div>
                </div>
                <div class="form-group">
                    <label asp-for="CompanyName">Company Name</label>
                    <input asp-for="CompanyName" class="form-control"/>
                    <span asp-validation-for="CompanyName"></span>
                </div>
                <div class="form-group">
                    <label asp-for="OrderDate">Order Date</label>
                    <input asp-for="OrderDate" class="form-control"/>
                </div>
                <div class="form-group">
                    <label asp-for="Stage">Stage</label>
                    <select asp-for="Stage" asp-items="FormDataHelper.GetOrderStages()" class="form-control"></select>
                </div>
                <div class="product-list">
                    @for (var i = 0; i < Model.Products.Count; i++)
                    {
                        <div class="row">
                            <input type="hidden" asp-for="@Model.Products[i].Id"/>
                            <div class="col-xs-6">
                                <label>@Model.Products[i].Name</label>
                            </div>
                            <div class="col-xs-6">
                                <input asp-for="@Model.Products[i].Quantity" placeholder="Quantity" class="form-control">
                            </div>
                        </div>
                    }
                </div>
                <div class="form-group">
                    <label asp-for="ShippingAddress">Ship To:</label><br/>
                    <select asp-for="ShippingAddress" class="form-control">
                        <option>Billing Address</option>
                        <option>Mailing Address</option>
                    </select>
                </div>
                <div class="form-group">
                    <label asp-for="OrderInstructions">Special Order Instructions</label>
                    <textarea asp-for="OrderInstructions" class="form-control" rows="5"></textarea>
                </div>
                <div class="form-group">
                    <label asp-for="Notes">Additional Notes</label>
                    <textarea asp-for="Notes" class="form-control" rows="5"></textarea>
                </div>
                <input type="submit" class="btn btn-primary pull-right">
            </div>
        </div>
    </form>
</div>